//test # and ## sign in macro


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define ROOT "/mnt/sd/"
#define NAME "kernel.img"

#define path(dir,name) dir##name
#define print(format,args...) printf(format,##args)
#define test(name) #name
#define UPDATE_FILE(id)	"/tmp/update_"#id".tgz"  // cannot use '##' sign
#define UPDATE_FILE_2(id)	"/tmp/update_"#id".tgz" 

#define SD_EXIST_SIZE 200

enum
{
	MON = 1,
	TUE = 2,
	SUN = 7
};

int main(int argc, char *argv[])
{
	//printf("macro PATH = %s\n", PATH);
	//printf("path(dir,name) = %s\n", path(ROOT,NAME));
	printf("path(dir,name) = %s\n", path(RO,OT));

	//printf("macro TEST = %s\n", TEST);
	printf("test(name) = %s\n", test(NAME));
	printf("test(MON) = %s\n", test(MON));
	//printf("#MON = %s\n", #MON);
	
	printf("%s%s\n", ROOT,NAME);
	printf("UPDATE_FILE(1)=%s\n",UPDATE_FILE(1));
	int i = 2;
	printf("UPDATE_FILE(2)=%s\n",UPDATE_FILE(i));

	printf("devid[%d] free %dM less %dM(exist size)!\n",1,120,SD_EXIST_SIZE);

	return 0;
}

